<?php
/**
 * 管理员列表页模板
 */


use yii\helpers\Html;
use kartik\grid\GridView;


$this->title = '管理员管理';

echo GridView::widget([
    'dataProvider' => $dataProvider,
    'panel' => [
        'type' => GridView::TYPE_DEFAULT,
        'heading' => '管理员列表',
    ],
    'toolbar' => [
        ['content' => Html::a('<i class="glyphicon glyphicon-plus"></i> 添加管理员', ['admin/add'], ['class' => 'btn btn-primary'])],        '{toggleData}'
    ],
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],
        'adminName',
        [
            'label' => '管理员组',
            'attribute' => 'roleID',
            'value' => 'adminRole.roleName',
        ],
        [
            'attribute' => 'agentID',
            'label' => '代理商',
            'value' => 'agent.agentName',
        ],
        'realName',
        'email',
        'phone',
        'lastLoginTime:datetime',
        'lastLoginIP',
        [
            'attribute' => 'status',
            'value' => function($model){
                return $model->status ? "正常" : "禁用";
            }
        ],
        ['class' => 'common\widgets\ActionColumn'],

    ],
]);
